﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Windvoice.Authorize;
using System.Configuration;

namespace Windvoice.Controllers
{
    public class UserController : Windvoice.Framework.ControllerBase
    {
        //
        // GET: /User/
        public ActionResult Connect()
        {
            var ReturnUrl = Request.QueryString["returnurl"];
            SinaConnector.GetAccessToken();

            return Redirect(ReturnUrl);
        }

        [HttpPost]
        public ActionResult Connect(int? id)
        {
            var CallbackUrl = ConfigurationManager.AppSettings["weiboCallbackUrl"];
            var ReturnUrl = Request.QueryString["returnurl"];
            var Url = SinaConnector.GetRequestToken();
            return Redirect(Url + "&oauth_callback="+CallbackUrl+"?returnurl=" + ReturnUrl);
        }
    }
}
